using System;
using System.Collections.Generic;
using SouthernLand.Common.DAL.Localtion;

namespace SouthernLand.Common.BOL.Location
{
    public class JobLocation : BizObject
    {
        #region Public Properties

        public Int32 JobLocationID { get; set; }

        public String JobLocationName { get; set; }

        public String JobLocationName_en { get; set; }

        public Int32 CountryID { get; set; }

        public Int32 DisplayOrder { get; set; }

        #endregion

        #region public static Methods

        public static int Insert(JobLocation obj)
        {
            var db = new JobLocationDAL();
            return db.Insert(obj);
        }

        public static bool Update(JobLocation obj)
        {
            var db = new JobLocationDAL();
            return db.Update(obj);
        }

        public static bool Delete(Int32 JobLocationID)
        {
            var db = new JobLocationDAL();
            return db.Delete(JobLocationID);
        }

        public static JobLocation GetJobLocationByID(Int32 JobLocationID)
        {
            var db = new JobLocationDAL();
            return db.GetJobLocationByID(JobLocationID);
        }

        public static string GetJobLocationNameByID(Int32 JobLocationID)
        {
            try
            {
                JobLocation obj = GetJobLocationByID(JobLocationID);
                return (Globals.LangVietNam()) ? obj.JobLocationName : obj.JobLocationName_en;
            }
            catch
            {
                return "";
            }
        }


        //Get All JobLocation
        public static List<JobLocation> GetAllJobLocation()
        {
            var db = new JobLocationDAL();
            return db.GetAllJobLocation(1, MAXROWS);
        }

        //Get All JobLocation
        public static List<JobLocation> GetAllJobLocation(int PageIndex, int PageSize)
        {
            var db = new JobLocationDAL();
            return db.GetAllJobLocation(PageIndex, PageSize);
        }

        // Get Count All records of Table  JobLocation
        public static int GetCountJobLocation()
        {
            var db = new JobLocationDAL();
            return db.GetCountJobLocation();
        }

        // Get JobLocationByCountryID
        public static List<JobLocation> GetJobLocationByCountryID(Int32 CountryID)
        {
            var db = new JobLocationDAL();
            return db.GetJobLocationByCountryID(CountryID, 1, MAXROWS);
        }


        // Get JobLocationByCountryID
        public static List<JobLocation> GetJobLocationByCountryID(Int32 CountryID, int PageIndex, int PageSize)
        {
            var db = new JobLocationDAL();
            return db.GetJobLocationByCountryID(CountryID, PageIndex, PageSize);
        }

        // Get JobLocationCountByCountryID
        public static int GetJobLocationCountByCountryID(Int32 CountryID)
        {
            var db = new JobLocationDAL();
            return db.GetJobLocationCountByCountryID(CountryID);
        }

        #endregion
    }
}